package com.qf.flash.ui.circle.adapter;

import android.view.View;
import android.widget.ImageView;

import com.qf.flash.R;
import com.qf.flash.model.CapacityBean;
import com.qf.flash.ui.home.MemberMsgActivity;
import com.qf.flash.utils.ImageLoader;
import com.qf.flashlib.adapter.BaseRViewItem;
import com.qf.flashlib.adapter.RViewHolder;

public class ListBottomItem extends BaseRViewItem<Object> {

    @Override
    public boolean isItemView(Object entity, int position) {
        return entity instanceof CapacityBean;
    }

    @Override
    public int getItemLayout() {
        return R.layout.item_list_bottom;
    }

    @Override
    public void convert(RViewHolder holder, Object entity, int position, int itemSize) {
        CapacityBean capacityBean = (CapacityBean) entity;
        ImageView head = holder.getView(R.id.iv_head);
        holder.setText(R.id.tv_rank, String.valueOf(position + 3));
        ImageLoader.loadCircle(holder.getmConvertView().getContext(), capacityBean.getPhoto(), head);
        holder.setText(R.id.tv_name, capacityBean.getName());
        holder.setText(R.id.tv_count, capacityBean.getCount() + "次");

        head.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                MemberMsgActivity.start(holder.getmConvertView().getContext(), capacityBean.getId(), "");
            }
        });
    }
}
